#ifndef UTILS_H
#define UTILS_H

#include "cocos2d.h"
#include "Box2D/Box2D.h"
#include "../ugame/include/ugame.h"

USING_NS_CC;

class Utils: public Ref {
protected:
public:
    static __Dictionary* getI18NInstance();
    static MenuItemSprite* createButton(char* normalFrameName, char* selectedFrameName, char* text, int fontSize, char* fontType, Color3B color);
    static MenuItemSprite* createButton(char* spriteFrameName);
    static MenuItemSprite* createButton(char* normalSpriteFrameName, char* selectedSpriteFrameName, bool flipX);
    static MenuItemSprite* createButton(char* normalSpriteFrameName, char* selectedSpriteFrameName);
    static MenuItemSprite* createButton(char* normalSpriteFrameName, char* selectedSpriteFrameName, char* disabledSpriteFrameName);
    static Label* createLabel(char* text, int fontSize);
    static Label* createLabel(char* text, char* fontName, int fontSize);
    static float random();
    static void drawObject(RectBody* rectBody, DrawNode* pen);
    static float distance(cocos2d::Point point1, cocos2d::Point point2);
    static bool b2Interact(Body* body1, Body* body2);
    static std::string readFile(std::string fileName, bool writeable, bool override, bool encrypt);
    static void writeFile(std::string data, std::string fileName, bool encrypt);
    static bool checkPointInRect(RectBody* rectBody, cocos2d::Point point);
    static bool checkPointInArc(ArcBody* arcBody, cocos2d::Point point);
    static RenderTexture* createStrokeText(Sprite* label, int size, Color3B color, GLubyte opacity);
    static std::string convertTimeString(int remainTime);
    static void safeRelease(Ref* object);
    static long getCurrentTimeInSeconds();
    static __Array* split(const std::string &s, char delim);
    static std::string encrypt(std::string toEncrypt);
    static std::string decrypt(std::string toDecrypt);
    static long adler32(char* data, int32_t len);
    static std::string encryptWithKey(std::string toEncrypt, std::string keyStr);
    static std::string base64_encode(char const* , unsigned int len);
    static std::string base64_decode(std::string const& s);
    static float getTimeFromJsonSpine(std::string JsonFile, std::string name);
    
private:
    Utils();
    virtual ~Utils();
};

#endif /* UTILS_H */


